package demo2;

import java.util.Scanner;

interface IShape {
    void draw();
}

class B implements IShape {

    @Override
    public void draw() {
        System.out.println("必须重写");
    }
}

class C implements IShape {
    @Override
    public void draw() {
        System.out.println("重写");
    }
}

abstract class D implements IShape {

}

public class Test2 {
    public static void drawShape(IShape iShape) {
        iShape.draw();

    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String a = scan.next();
        System.out.println(a);
        String b = scan.nextLine();
        System.out.println(b);
    }

    public static void main1(String[] args) {
        B b = new B();
        drawShape(b);//向上继承
        drawShape(new C());
        IShape iShape = new C();
        drawShape(iShape);//多态

    }
}
